package com.hunk.core.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

/**@see
 * 		注入Request/Response对象至SpringMVC执行上下文对象中
 * 		com.hunk.core.web.ControllerContext
 * @author Hunk
 * @since 2013-3-5
 */
public class ControllerContextInterceptor extends HandlerInterceptorAdapter {
	
	public boolean preHandle(HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse, Object handler)
			throws Exception {
		ControllerContext.getContext().setRequest(httpServletRequest);
		ControllerContext.getContext().setResponse(httpServletResponse);
		return super.preHandle(httpServletRequest, httpServletResponse, handler);
	}
	
}
